package com.cq.jackmar.rxdemo.http.httphelper;


import com.cq.jackmar.rxdemo.http.NetWorkCenter;
import com.cq.jackmar.rxdemo.http.base.BaseResult;
import com.cq.jackmar.rxdemo.http.httpapi.ApiUser;
import com.cq.jackmar.rxdemo.http.util.RXJavaUtil;

import rx.Observable;
import rx.Subscriber;

/**
 * @author dapeng
 * @title 封装用户模块的接口调用
 * @data 2016/9/5.
 */
public class HttpHelperUser {
    //接口类
    private ApiUser mApiUser;
    public static final HttpHelperUser INSTANCE = new HttpHelperUser();

    //私有的构造方法
    private HttpHelperUser() {
        //手动创建一个OkHttpClient并设置超时时间
        mApiUser = NetWorkCenter.getApi(ApiUser.class);
    }

    //获取单例
    public static HttpHelperUser getInstance() {
        return INSTANCE;
    }

    //获取短信验证码
    public void test(Subscriber<BaseResult> subscriber) {
        Observable observable = mApiUser.test();
        RXJavaUtil.toSubscribe(observable, subscriber);
    }

}
